package binarysearch;

import java.util.Arrays;

public class Solution268 {
    public int missingNumber(int[] nums) {
        int count=0;
        for (int num : nums) {
            count+=num;
        }

        int total=0;
        for (int i = 0; i <=nums.length ; i++) {
            total += i;
        }

        return total-count;
    }

    public static void main(String[] args) {
        int[] nums = new int[]{9,6,4,2,3,5,7,0,1};
        Solution268 solution268 = new Solution268();

        int missingNumber = solution268.missingNumber(nums);

        System.out.println("missingNumber = " + missingNumber);

    }
}
